﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Thirteen23.TED.Data
{
    public class TedTalk
    {
        public string Title { get; set; }
        public string Author { get; set; }
        public string Description { get; set; }
        public DateTime Date { get; set; }
        public string Category { get; set; }
        public string Url { get; set; }
        public string MediaLocation { get; set; }
        public string ImageLocation { get; set; }
        public string ThumbnailLocation { get; set; }

        public string SanitizedTitle
        {
            get
            {
                if (string.IsNullOrEmpty(Title)) return string.Empty;

                string tempTitle = Title.Substring(Title.IndexOf(':') + 1);
                tempTitle = tempTitle.Substring(tempTitle.IndexOf(':') + 1);
                tempTitle = tempTitle.Substring(0, tempTitle.IndexOf(" - "));

                return tempTitle.Trim();
            }
        }

        public string DateString
        {
            get
            {
                return Date.ToString("m").ToUpper();
            }
        }
    }
}
